Dynomotion

Group: DynoMotion Message: 424 From: Azd M Date: 6/8/2010
Subject: WaitUntil function
Hi all,
May I know the what is the start time of this function? is it from the start of the thread or the start of the execution of the function itself. for example waitUntil(1.0) this means to wait for 1sec but I am not sure it is 1sec from moment this function executed or from the start of the thread.
does the program stay there or it continue executes the other threads?
thanks
Azed.
Group: DynoMotion Message: 425 From: Tom Kerekes Date: 6/8/2010
Subject: Re: WaitUntil function
Hi Azed,
 
KMotion/KFlop maintains an absolute time in seconds since the board was powered up as a 64-bit double-precision floating-point number that has 20 nanosecond resolution and can span years of time.
 
Time_sec() will return this absolute time.
 
WaitUntil(xx) will wait until the specified absolute time passes.
 
For example to implement a delay of 1 second you might do:
 
double T0;
 
T0 = Time_sec();
 
// possibly do something else
 
WaitTill(T0+1.0);
 
This technique has some advantages over Delay_sec(1.0) because it is based on absolute time which avoids small errors that can accumulate if performed many times.  Also it may allow you to do something else while waiting. 
 
The program basically stays there, unless of course its time slice ends and it gets pre-empted to execute other threads.  For a description of how KFlop multi-tasking works see:
 
 
Regards
TK